home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / Xm / XmResolveAllPartOffsets.z / XmResolveAllPartOffsets
Text File  |  1998-10-30  |  11KB  |  199 lines

  1.  
  2.  
  3.  
  4.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss - A function that allows writing of
  10.           upward-compatible applications and widgets
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           #include <Xm/Xm.h>
  14.           vvvvooooiiiidddd XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss(
  15.           WWWWiiiiddddggggeeeettttCCCCllllaaaassssssss wwwwiiiiddddggggeeeetttt____ccccllllaaaassssssss,
  16.           XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr **** ooooffffffffsssseeeetttt,
  17.           XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr **** ccccoooonnnnssssttttrrrraaaaiiiinnnntttt____ooooffffffffsssseeeetttt);
  18.  
  19.      VVVVEEEERRRRSSSSIIIIOOOONNNN
  20.           This page documents Motif 2.1.
  21.  
  22.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.                NNNNooootttteeee::::
  24.  
  25.                This routine is obsolete and exists for compatibility
  26.                with previous releases. You should call
  27.                XXXXmmmmeeeeRRRReeeessssoooollllvvvveeeePPPPaaaarrrrttttOOOOffffffffsssseeeettttssss instead.
  28.  
  29.           The use of offset records requires two extra global
  30.           variables per widget class.  The variables consist of
  31.           pointers to arrays of offsets into the widget record and
  32.           constraint record for each part of the widget structure.
  33.           The XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss function allocates the offset
  34.           records needed by an application to guarantee upward-
  35.           compatible access to widget instance and constraint records
  36.           by applications and widgets.  These offset records are used
  37.           by the widget to access all of the widget's variables.  A
  38.           widget needs to take the steps described in the following
  39.           paragraphs.
  40.  
  41.           Instead of creating a resource list, the widget creates an
  42.           offset resource list.  To accomplish this, use the
  43.           XXXXmmmmPPPPaaaarrrrttttRRRReeeessssoooouuuurrrrcccceeeestructure and the XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt macro.  The
  44.           XXXXmmmmPPPPaaaarrrrttttRRRReeeessssoooouuuurrrrcccceeee data structure looks just like a resource
  45.           list, but instead of having one integer for its offset, it
  46.           has two shorts.  This structure is put into the class record
  47.           as if it were a normal resource list. Instead of using
  48.           XXXXttttOOOOffffffffsssseeeetttt for the offset, the widget uses XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt.
  49.  
  50.           If the widget is a subclass of the Constraint class and it
  51.           defines additional constraint resources, create an offset
  52.           resource list for the constraint part as well.  Instead of
  53.           using XXXXttttOOOOffffffffsssseeeetttt for the offset, the widget uses
  54.           XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttPPPPaaaarrrrttttOOOOffffffffsssseeeetttt in the constraint resource list.
  55.  
  56.           XmPartResource resources[] = {
  57.                   {       BarNxyz, BarCXyz, XmRBoolean, sizeof(Boolean),
  58.                           XmPartOffset(Bar,xyz), XmRImmediate, (XtPointer)False } };
  59.           XmPartResource constraints[] = {
  60.  
  61.  
  62.  
  63.      Page 1                                         (printed 10/24/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  71.  
  72.  
  73.  
  74.                   {       BarNmaxWidth, BarNMaxWidth,
  75.                     XmRDimension, sizeof(Dimension),
  76.                     XmConstraintPartOffset(Bar,max_width),
  77.                     XmRImmediate, (XtPointer)100 } };
  78.  
  79.           Instead of putting the widget size in the class record, the
  80.           widget puts the widget part size in the same field.  If the
  81.           widget is a subclass of the Constraint class, instead of
  82.           putting the widget constraint record size in the class
  83.           record, the widget puts the widget constraint part size in
  84.           the same field.
  85.  
  86.           Instead of putting XXXXttttVVVVeeeerrrrssssiiiioooonnnn in the class record, the widget
  87.           puts XXXXttttVVVVeeeerrrrssssiiiioooonnnnDDDDoooonnnnttttCCCChhhheeeecccckkkk in the class record.
  88.  
  89.           Define a variable, of type XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr, to point to the
  90.           offset record.  If the widget is a subclass of the
  91.           Constraint class, define a variable of type XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr to
  92.           point to the constraint offset record.  These can be part of
  93.           the widget's class record or separate global variables.
  94.  
  95.           In class initialization, the widget calls
  96.           XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss, passing it pointers to the class
  97.           record, the address of the offset record, and the address of
  98.           the constraint offset record.  If the widget not is a
  99.           subclass of the Constraint class, it should pass NULL as the
  100.           address of the constraint offset record.  This does several
  101.           things:
  102.  
  103.              +o  Adds the superclass (which, by definition, has already
  104.                 been initialized) size field to the part size field
  105.  
  106.              +o  If the widget is a subclass of the Constraint class,
  107.                 adds the superclass constraint size field to the
  108.                 constraint size field
  109.  
  110.              +o  Allocates an array based upon the number of
  111.                 superclasses
  112.  
  113.              +o  If the widget is a subclass of the constraint class,
  114.                 allocates an array for the constraint offset record
  115.  
  116.              +o  Fills in the offsets of all the widget parts and
  117.                 constraint parts with the appropriate values,
  118.                 determined by examining the size fields of all
  119.                 superclass records
  120.  
  121.              +o  Uses the part offset array to modify the offset
  122.                 entries in the resource list to be real offsets, in
  123.                 place
  124.  
  125.           The widget defines a constant that will be the index to its
  126.  
  127.  
  128.  
  129.      Page 2                                         (printed 10/24/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  137.  
  138.  
  139.  
  140.           part structure in the offsets array.  The value should be 1
  141.           greater than the index of the widget's superclass.
  142.           Constants defined for all XXXXmmmmwidgets can be found in XXXXmmmmPPPP....hhhh.
  143.  
  144.           #define BarIndex (XmBulletinBIndex + 1)
  145.  
  146.           Instead of accessing fields directly, the widget must always
  147.           go through the offset table.  The XXXXmmmmFFFFiiiieeeelllldddd and
  148.           XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttFFFFiiiieeeelllldddd macros help you access these fields.
  149.           Because the XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt, XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttPPPPaaaarrrrttttOOOOffffffffsssseeeetttt, XXXXmmmmFFFFiiiieeeelllldddd,
  150.           and XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttFFFFiiiieeeellllddddmacros concatenate things, you must
  151.           ensure that there is no space after the part argument.  For
  152.           example, the following macros do not work because of the
  153.           space after the part (Label) argument:
  154.  
  155.           XmField(w, offset, Label, text, char *)
  156.           XmPartOffset(Label, text).
  157.  
  158.           Therefore, you must not have any spaces after the part
  159.           (Label) argument, as illustrated here:
  160.  
  161.           XmField(w, offset, Label, text, char *)
  162.  
  163.           You can define macros for each field to make this easier.
  164.           Assume an integer field _x_y_z:
  165.  
  166.           #define BarXyz(w) (*(int *)(((char *) w) + \
  167.                   offset[BarIndex] + XtOffset(BarPart,xyz)))
  168.  
  169.           For constraint field _m_a_x__w_i_d_t_h:
  170.  
  171.           #define BarMaxWidth(w) \
  172.                   XmConstraintField(w,constraint_offsets,Bar,max_width,Dimension)
  173.  
  174.           The parameters for XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss are
  175.  
  176.           _w_i_d_g_e_t__c_l_a_s_s
  177.                     Specifies the widget class pointer for the created
  178.                     widget
  179.  
  180.           _o_f_f_s_e_t    Returns the offset record
  181.  
  182.           _c_o_n_s_t_r_a_i_n_t__o_f_f_s_e_t
  183.                     Returns the constraint offset record
  184.  
  185.      RRRREEEELLLLAAAATTTTEEEEDDDD IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  186.           XXXXmmmmRRRReeeessssoooollllvvvveeeePPPPaaaarrrrttttOOOOffffffffsssseeeettttssss(3).
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                         (printed 10/24/98)
  196.  
  197.  
  198.  
  199.